{% extends 'TopxiaWebBundle:OpenCourseManage:open-course-layout.html.twig' %}

{% block title %}{{'课时管理'|trans}} - {{ parent() }}{% endblock %}

{% set side_nav = 'lesson' %}
{% set script_controller = 'open-course-manage/lesson' %}

{% block main %}

<div class="panel panel-default panel-col lesson-manage-panel" data-file-status-url={{path('course_manage_file_status')}}>
	<div class="panel-heading">
		<div class="pull-right">
			<button class="btn btn-info btn-sm" {% if items %}disabled="disabled"{% endif %} id="lesson-create-btn" data-backdrop="static" data-keyboard="false" data-url="{% if course.type == 'open' %}{{ path('open_course_manage_lesson_create', {id:course.id}) }}{% endif %}"><i class="glyphicon glyphicon-plus"></i> {% if course.type == 'open' %}{{'课时'|trans}}{% endif %}</button>
		</div>
		{{'课时管理'|trans}}
	</div>

	<div class="alert alert-warning only-one-lesson-notify" {% if items %}style="display:none;"{% endif %}>公开课当前仅支持添加一个课时！</div>

	{% if items is empty %}

	 <div class="empty">{{'暂无课时内容！'|trans}}</div>

	 {% endif %}

	<div class="panel-body">
		<ul class="lesson-list sortable-list" id="course-item-list" data-sort-url="{{ path('open_course_manage_lesson_sort', {id:course.id}) }}">
			{% for id, item in items %}
			  
			  {% if 'lesson' in id  %}
					{% include 'TopxiaWebBundle:OpenCourseLessonManage:open-course-lesson-list-item.html.twig' with {lesson: item, file: files[item.mediaId]|default(null)} %}
			  {% endif %}
			{% endfor %}

		</ul>
	</div>
</div>

{% endblock %}
